- /* smmoutfl.cpp by K.Tsuru */
- // function ID = 004 DRADIX
- /************************
- SNManager class
- Change the output stream.
- *************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- static FILE* openStream = NULL;
- static int open = -1;
-
- void SNManager::CloseFile(){
- if(open > 0) SNManager::OutPutFile(NULL);
- }
- // function ID = 004
- // a static function of SNManager class
- FILE* SNManager::OutPutFile(const char* fname, bool ovw){
- if(fname == NULL){
- if(stream == openStream) fclose(openStream);
- stream = stdout; open = 0;
- return stream;
- }
- if( (ovw == false) && (openStream = fopen(fname,"rt")) != NULL){
- fprintf(stderr, "\aFile \"%s\" already exists. Over write ?(y/n) ", fname);
- if( YesOrNo() == 0){
- fclose(openStream);
- stream = stdout; open = 0;
- fprintf(stderr, "Do you continue ?(y/n) ");
- if(YesOrNo() == 0) exit(EXIT_FAILURE);
- return stream;
- }
- }
- openStream = fopen(fname,"wt");
- if(openStream == NULL){
- fprintf(stderr, "Cannot open output file %s.\n", fname);
- exit(EXIT_FAILURE);
- } else {
- open = 1;
- }
- stream = openStream;
- return stream;
- }
smmoutfl.cpp : last modifiled at 2017/07/16 16:00:03(1,144 bytes)
created at 2016/04/11 11:36:47
The creation time of this html file is 2017/10/27 10:59:17 (Fri Oct 27 10:59:17 2017).